/**
 * The download info view.
 *
 * (c) Copyright 2011 Nokia Corporation. All rights reserved.
 */

import Qt 4.7

import "../script/common.js" as CommonScript

Flickable {
    id: downloadInfoViewContainer;
    x: 10;
    y: topBar.height + 5;
    width: backgroundImage.width - 20;  // 2 * 10 px margins
    height: backgroundImage.height - topBar.height - 5;
    contentWidth: width;
    contentHeight: betaDownloadInfo.height;
    flickableDirection: "VerticalFlick";

    Connections {
        target: btnExitBack;
        // Called when the Back button is clicked.
        onButtonClicked: {
            // We're only interested in back to details view functionality here.
            if (btnExitBack.backFunctionality ==
                    CommonScript.BACK_TO_DETAILS_VIEW) {
                btnExitBack.backFunctionality =
                        betaViewContainer.backFunctionality;

                // Destroy the download info view and show the details view.
                detailsViewContainer.downloadInfoViewObject.destroy();
                detailsViewContainer.opacity = 1;
            }
        }
    }

    Text {
        id: betaDownloadInfo;
        width: downloadInfoViewContainer.width;
        wrapMode: "WordWrap";

        onLinkActivated: {
            Qt.openUrlExternally(link);
        }
    }

    function showDownloadInfo(downloadInfo) {
        betaDownloadInfo.text = downloadInfo;
    }
}
